home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 4_17.lha / 4_17 / 4_17a9.c < prev    next >
Text File  |  1993-08-08  |  543b  |  25 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / allocate list element and
  6. / save current token info
  7. nline tok *newtok(tok *curtok)
  8.  
  9.    tok *thistok = new tok;
  10.    thistok->length = curtok->length;
  11.  
  12.    if ((curtok->length > 0) && curtok->value)
  13. {
  14. thistok->value = new char[curtok->length + 1];
  15. strcpy(thistok->value, curtok->value);
  16. }
  17.  
  18.    else
  19. thistok->value = 0;
  20.  
  21.    thistok->tok_type = curtok->tok_type;
  22.    thistok->next = 0;
  23.    return thistok;
  24.  
  25.